console.log("The Object.keys() method returns an array of a given object's own enumerable properties. 类似for in循环, 但只返回本身的属性, 不查找原型链. 一般用于遍历对象属性")

console.log('如果要所有属性, 包括不可遍历的, 可以使用Object.getOwnPropertyNames()')

var arr = ['a', 'b', 'c'];
console.log('array: ' + Object.keys(arr)); // console: ['0', '1', '2']


// array like object with random key ordering
var an_obj = { 100: 'a', 2: 'b', 7: 'c' };
console.log('array like object: ' + Object.keys(an_obj)); // console: ['2', '7', '100']

// getFoo is property which isn't enumerable
var my_obj = Object.create({}, { getFoo: { value: function() { return this.foo; }, 
	   //enumerable: true 
	 } 
});
my_obj.foo = 1;

console.log('object: ' + Object.keys(my_obj)); // console: ['foo']
